package cn.duli.xianer.service.impl;

import cn.duli.xianer.dao.ShopcarMapper;
import cn.duli.xianer.pojo.Shopcar;
import cn.duli.xianer.service.ShopcarService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ShopcarServiceImpl implements ShopcarService {

    @Resource
    private ShopcarMapper shopcarMapper;

    @Override
    public int save(Shopcar shopcar) {
        shopcarMapper.save(shopcar);
        return shopcar.getsId();
    }

    @Override
    public Shopcar findById(Integer sId) {
        return shopcarMapper.findById(sId);
    }

    @Override
    public Shopcar findByGoodId(Integer gId) {
        return shopcarMapper.findByGoodId(gId);
    }

    @Override
    public List<Shopcar> findByUserId(Integer uId) {
        return shopcarMapper.findByUserId(uId);
    }

    @Override
    public void updateChecked(Integer sId) {
        shopcarMapper.updateChecked(sId);
    }

    @Override
    public void updateNotCheck(Integer sId) {
        shopcarMapper.updateNotCheck(sId);
    }

    @Override
    public void deleteById(Integer sId) {
        shopcarMapper.deleteById(sId);
    }

    @Override
    public int findCountByUserId(Integer uId) {
        return shopcarMapper.findCountByUserId(uId);
    }

    @Override
    public int findCheckCountByUserId(Integer uId) {
        return shopcarMapper.findCheckCountByUserId(uId);
    }

    @Override
    public List<Shopcar> findGoodsByUserId(Integer uId) {
        return shopcarMapper.findGoodsByUserId(uId);
    }

    @Override
    public void deleteByUidAndGid(Integer uId, Integer gId) {
        shopcarMapper.deleteByUidAndGid(uId, gId);
    }

    @Override
    public Shopcar findByGidAndUid(Integer uId, Integer gId) {
        return shopcarMapper.findByGidAndUid(uId, gId);
    }

    @Override
    public void updateCheckedByUidAndGid(Integer uId, Integer gId) {
        shopcarMapper.updateCheckedByUidAndGid(uId, gId);
    }


}
